home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / MacApp Documentation / MacApp AppleLink Messages / MacApp.Tech$ 4⁄13⁄90 / 1072-Re[2] Setting Print -Apr90 < prev    next >
Encoding:
Text File  |  1990-04-16  |  2.9 KB  |  107 lines  |  [TEXT/GEOL]

  1. Item forwarded  by  A33          to A34
  2.  
  3. Item    1823566                         10-April-90        13:50PDT
  4.  
  5. From:   AACO                            Arthur Andersen, Glenn A Noga,VCA
  6.  
  7. To:     D4684                           Robins Analytics, S Robins,PRT
  8.  
  9. cc:     MACAPP.TECH$                    MacApp Technical
  10.  
  11. Sub:    Re: Re: Setting Print record…
  12.  
  13. Doug,
  14. Thanks for the tip on saving the print record as a resource.  After digging
  15. around some more, I was able to set up my default print record with the
  16. following code:
  17.  
  18. FUNCTION TSaleRPrintHandler.DoMenuCommand(aCmdNumber: CmdNumber): TCommand;
  19. OVERRIDE;
  20.  
  21.    TYPE
  22.    TXWord  = PACKED RECORD
  23.    CASE INTEGER OF
  24.    0:
  25.    (c1, c0: CHAR);
  26.    1:
  27.    (b1, b0: SignedByte);
  28.    2:
  29.    (f15, f14, f13, f12, f11, f10, f9, f8, f7, f6, f5, f4, f3, f2, f1, f0:
  30.         BOOLEAN);
  31.    3:
  32.    (i0: INTEGER);
  33.    END;
  34.  
  35.    MyPrXInfo   = RECORD{ This is used to stuff values into the Print Record }
  36.    dummyLong   : LongInt;
  37.    aInteger: Integer;
  38.    adummyInt   : Integer;
  39.    dummyLong3  : LongInt;
  40.    dummyLong4  : LongInt;
  41.    END;
  42.  
  43.  CONST
  44.     kReductionFactor = 53;
  45.  
  46.    VAR
  47.    didChange   : Boolean;
  48.  
  49.    BEGIN
  50.    DoMenuCommand := gNoChanges;
  51.  
  52.    { • Handle the menu commands for printing }
  53.    CASE aCmdNumber OF
  54.    cPrint,
  55.    cPageSetup,
  56.    cPrintOne:
  57.    BEGIN
  58.  
  59.  
  60. {• Now we need to tweak the print record so that the print view is set to be   }
  61. {  Landscape at 53% Reduction.  Note that we only reduce if not dealing with a }
  62. {  imagewriter }
  63.  
  64. { we need to do this so that each time a document is printed   }
  65. { a new, untarnished print record is created.  }
  66. fDocument.fSharePrintInfo := FALSE;
  67. SELF.SetDefaultPrintInfo;
  68. fDocument.fSharePrintInfo := TRUE;
  69.  
  70. WITH THPrint(fHPrint)^^ DO
  71.    BEGIN
  72.    {The orientation is set to landscape by clearing bit 14 in wdev!!!  }
  73.    BitClr(Ptr(@prStl.wdev),14);
  74.    WITH TXWord(prStl.wDev) DO
  75.    IF b1 <> 1 THEN { 1 = bDevCItoh => ImageWriter }
  76.    BEGIN
  77.    {• OK, we have a laserwriter so lets reduce the image by 53 %   }
  78.    {   This is done by setting the value for the reduction percentage  }
  79.    MyPrXInfo(prXInfo).aInteger := kReductionFactor;
  80.    END;
  81. END;
  82.  
  83. ValidatePrintRecord(didChange);{ This call recomputes page and paper stuff}
  84.                                 { based on the print driver and the reduction/}
  85. {$Push} {$H-}                   { orientation.}
  86. WITH  fPageAreas.thePaper, fMarginRes, THPrint(fHPrint)^^  DO
  87. { Recompute effective device resolution to set up our own margins}
  88.    BEGIN
  89.    fPageAreas.theInk := prInfo.rPage;
  90.    fPageAreas.thePaper := rPaper;
  91.    h := (IntMultiply(iPrPgFract, right - left)) DIV prStl.iPageH;
  92.    v := (IntMultiply(iPrPgFract, bottom - top)) DIV prStl.iPageV;
  93.    END;
  94. {$POP}
  95.  
  96. DoMenuCommand := INHERITED DoMenuCommand(aCmdNumber);
  97. END;
  98.  
  99. This has the advantage of dealing with the print driver each time in order to
  100. figure out the page, paper, etc sizes.
  101.  
  102. Eric Marking
  103. Andersen Consulting
  104.  
  105. AppleLink: AACO
  106.  
  107.